package service

import (
	"context"
	"go-admin/server/internal/domain"
	"go-admin/server/internal/repository"
)

type PackServer interface {
	Create(ctx context.Context, pack domain.Pack) error
	GetPackLst(ctx context.Context, page, limit int) ([]domain.Pack, int, error)
}

type packServer struct {
	repo repository.PackRepository
}

func NewPackServer(repo repository.PackRepository) PackServer {
	return &packServer{
		repo: repo,
	}
}

func (p *packServer) Create(ctx context.Context, pack domain.Pack) error {
	return p.repo.Create(ctx, pack)
}

func (p *packServer) GetPackLst(ctx context.Context, page, limit int) ([]domain.Pack, int, error) {
	lsits, total, err := p.repo.List(ctx, page, limit)
	return lsits, total, err
}
